<template>
  <div class="task-export">
    <div class="task-export-container">
      <div class="heander-info">
        <span class="title">任务查询</span>
        <el-button type="primary" @click="handleExport" v-role="'A030201002'"
          >一键导出</el-button
        >
      </div>
      <div class="container" v-role="'A030201001'">
        <el-form :model="model" label-width="0">
          <el-form-item label=" ">
            <el-input
              class="textarea"
              type="textarea"
              v-model="model.name"
              placeholder="请输入序列号(序列号以列表形式输入)"
            />
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive, onMounted } from "vue";
import { Message } from "@arco-design/web-vue";
import * as Api from "@/api/dataExport/dataExport";

const model = reactive({
  name: "",
});

const handleExport = () => {
  !model.name && !model.name.trim() && Message.warning("请输入序列号，再进行导出！");
  model.name && getExport();
};

const getExport = async () => {
  const seriesUids = model.name.trim().split("\n");
  await Api.taskExport({ seriesUids });
};
</script>

<style lang="less">
.task-export {
  background-color: #f5f5f5;
  padding: 20px;
  width: 100%;
  height: 100%;
  .task-export-container {
    background-color: #fff;
    min-height: 100%;
    padding: 20px;
    .heander-info {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      .title {
        font-weight: 700;
        font-size: 20px;
        color: #333333;
      }
    }
  }
  .el-form {
    .el-form-item {
      > label {
        display: none;
      }
    }
    .textarea {
      textarea {
        height: 440px;
        padding: 20px;
      }
    }
  }
}
</style>
